/*

Author   : chaos

FileName : const.cpp

Date     : 11/08/17 22:55:23

*/
#include <iostream>
#include <cstring>
using namespace std;

class Book
{
    private:
        char name[30];
        const long index;
    public:
        Book(long i_index) : index(i_index)
    {
        strcpy(name,"none");
    }
        ~Book(){ cout << " Destructor is called !" << endl; }

        void show_data() const
        { cout <<" name :" << name << "index :" << index << endl; }

        void set_name(char * i_name)
        {
            strcpy(name,i_name);
        }

        void set_index(long i_index)
        {

        }
};

int main(int argc ,char *argv[])
{
    Book A_Book(1245);
    A_Book.set_name("the C++ Bible");
    A_Book.show_data();

    const Book B_Book(1235);

    B_Book.set_name("The C++ Bible, 2nd");

    B_Book.show_data();
   return 0;
}
